import request from "../api/request";
import { urlConfig } from "../api/urlConfig";
import axios from "axios";
const MES = {
  // 登录
  queryLogin: (params) => {
    const url = urlConfig.queryLogin;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取络筒分组数据
  queryGroupWenShiList: (params) => {
    const url = urlConfig.queryGroupWenShiList;
    return new Promise((resolve, reject) => {
      request
        .post1(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  queryGroupWenShiList24H: (params) => {
    const url = urlConfig.queryGroupWenShiList24H;
    return new Promise((resolve, reject) => {
      request
        .post1(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取络筒分组数据
  queryGroupLuoTongList: (params) => {
    const url = urlConfig.queryGroupLuoTongList;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取络筒分组数据
  queryGroupLuoTongList1: (params) => {
    const url = urlConfig.queryGroupLuoTongList1;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取并条分组数据
  queryGroupBingTiaoList: (params) => {
    const url = urlConfig.queryGroupBingTiaoList;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取梳棉机分组数据
  queryGroupShuMianJiList: (params) => {
    const url = urlConfig.queryGroupShuMianJiList;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取太行粗纱欧姆龙分组数据
  queryGroupTxcsomlList: (params) => {
    const url = urlConfig.queryGroupTxcsomlList;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取细纱分组数据
  queryGroupXiShaList: (params) => {
    const url = urlConfig.queryGroupXiShaList;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取多仓分组数据
  queryGroupDuoCangList: (params) => {
    const url = urlConfig.queryGroupDuoCangList;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取精开棉机分组数据
  queryGroupKaiMianList: (params) => {
    const url = urlConfig.queryGroupKaiMianList;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取抓棉机分组数据
  queryGroupZhuaMianList: (params) => {
    const url = urlConfig.queryGroupZhuaMianList;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取清花分组数据
  queryGroupQingHuaList: (params) => {
    const url = urlConfig.queryGroupLcList;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  /**
   * 实时数据
   */
  // 络筒实时数据查询接口
  queryNewestLuoTong: (params) => {
    const url = urlConfig.queryNewestLuoTong;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 并条实时数据查询接口
  queryNewestBingTiao: (params) => {
    const url = urlConfig.queryNewestBingTiao;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 梳棉机1207实时数据查询接口
  queryNewestShuMianji: (params) => {
    const url = urlConfig.queryNewestShuMianji;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 梳棉机2017A实时数据查询接口
  queryNewestShuMianjiA: (params) => {
    const url = urlConfig.queryNewestShuMianjiA;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 太行粗纱欧姆龙实时数据查询接口
  queryNewestTxcsoml: (params) => {
    const url = urlConfig.queryNewestTxcsoml;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 新粗纱欧姆龙实时数据查询接口
  queryNewestCuShaji: (params) => {
    const url = urlConfig.queryNewestCuShaJi;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 细纱马佐里实时数据查询接口
  queryNewestXiShaMzl: (params) => {
    const url = urlConfig.queryNewestXiShaMzl;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 多仓实时数据查询接口
  queryNewestDuoCang: (params) => {
    const url = urlConfig.queryNewestDuoCang;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 精开棉实时数据查询接口
  queryNewestKaiMian: (params) => {
    const url = urlConfig.queryNewestKaiMian;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 抓棉实时数据查询接口
  queryNewestZhuaMian: (params) => {
    const url = urlConfig.queryNewestZhuaMian;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 动力柜实时数据查询接口
  queryNewestDongLi: (params) => {
    const url = urlConfig.queryNewestDongli;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取细纱折现数据
  queryLineXiSha: (params) => {
    const url = urlConfig.queryLineXiSha;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取状态数据
  queryStatus: (params) => {
    const url = urlConfig.queryStatus;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 获取状态数据明细
  queryStatusDetail: (params) => {
    const url = urlConfig.queryStatusDetail;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 细砂分组实时数据查询接口
  queryNewestXiSha: (params) => {
    const url = urlConfig.queryNewestXiSha;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 细砂分组明细实时数据查询接口
  queryNewestXiShaDetail: (params) => {
    const url = urlConfig.queryNewestXiShaDetail;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 粗纱分组实时数据查询接口
  queryNewestCuSha: (params) => {
    const url = urlConfig.queryNewestCuSha;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 粗砂分组明细实时数据查询接口
  queryNewestCuShaDetail: (params) => {
    const url = urlConfig.queryNewestCuShaDetail;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 络筒分组实时数据查询接口
  queryNewestLuoTong1: (params) => {
    const url = urlConfig.queryNewestLuoTong1;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 络筒分组明细实时数据查询接口
  queryNewestLuoTongDetail: (params) => {
    const url = urlConfig.queryNewestLuoTongDetail;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 络筒分组明细实时数据查询接口
  queryNewestLuoTongDetail1: (params) => {
    const url = urlConfig.queryNewestLuoTongDetail1;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 井条分组实时数据查询接口
  queryNewestJingTiao: (params) => {
    const url = urlConfig.queryNewestJingTiao;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 井条分组明细实时数据查询接口
  queryNewestJingTiaoDetail: (params) => {
    const url = urlConfig.queryNewestJingTiaoDetail;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 梳棉分组实时数据查询接口
  queryNewestShuMian: (params) => {
    const url = urlConfig.queryNewestShuMian;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 梳棉分组明细实时数据查询接口
  queryNewestShuMianDetail: (params) => {
    const url = urlConfig.queryNewestShuMianDetail;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 清花分组实时数据查询接口
  queryNewestQingHua: (params) => {
    const url = urlConfig.queryNewestQingHua;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 清花分组用工实时数据查询接口
  queryNewestQingHuaWorker: (params) => {
    const url = urlConfig.queryNewestQingHuaWorker;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 清花分组用工实时汇总数据查询接口
  queryNewestQingHuaWorkerSum: (params) => {
    const url = urlConfig.queryNewestQingHuaWorkerSum;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // 清花分组明细实时数据查询接口
  queryNewestQingHuaDetail: (params) => {
    const url = urlConfig.queryNewestQingHuaDetail;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  //获取1.5级用工/明细数据
  queryWorker: (params) => {
    const url = urlConfig.queryWorker;
    return new Promise((resolve, reject) => {
      request
        .post1(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },

  /**
   * 能耗
   */
  //空调
  queryGroupKongTiao: (params) => {
    const url = urlConfig.queryKongTiao;
    return new Promise((resolve, reject) => {
      request
        .get1(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  //空压
  queryGroupKongYa: (params) => {
    const url = urlConfig.queryKongYa;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  /**
   * Echarts
   */
  // 获取电表接口
  queryGroupDianBiao: (params) => {
    const url = urlConfig.getGroupDianBiao;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts1
  queryEcharts1: (params) => {
    const url = urlConfig.echarts1;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts2
  queryEcharts2: (params) => {
    const url = urlConfig.echarts2;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts3
  queryEcharts3: (params) => {
    const url = urlConfig.echarts3;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts4
  queryEcharts4: (params) => {
    const url = urlConfig.echarts4;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts5
  queryEcharts5: (params) => {
    const url = urlConfig.echarts5;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts6
  queryEcharts6: (params) => {
    const url = urlConfig.echarts6;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts7
  queryEcharts7: (params) => {
    const url = urlConfig.echarts7;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts8
  queryEcharts8: (params) => {
    const url = urlConfig.echarts8;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts10
  queryEcharts10: (params) => {
    const url = urlConfig.echarts10;
    params = Object.assign({ org: "恒源", cj: "五纺", gongxu: "细纱" }, params);
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts11
  queryEcharts11: (params) => {
    const url = urlConfig.echarts11;
    params = Object.assign({ org: "恒源", cj: "五纺", gongxu: "络筒" }, params);
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts12
  queryEcharts12: (params) => {
    const url = urlConfig.echarts12;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  },
  // echarts12Line
  queryEcharts12Line: (params) => {
    const url = urlConfig.echarts12Line;
    return new Promise((resolve, reject) => {
      request
        .post(url, params)
        .then((res) => {
          resolve(res.data);
        })
        .catch((err) => {
          reject(err);
        });
    });
  }
};
export default MES;
export { MES };
